package com.xxgc.wujiaoservice.controller;

import cn.dev33.satoken.stp.StpUtil;
import com.xxgc.wujiaoservice.entity.UsersEntity;
import com.xxgc.wujiaoservice.entity.UsersEntityRepository;

import com.xxgc.wujiaoservice.result.Result;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
@Tag(name = "用户信息")
public class UserInfoController {
    @Resource
    UsersEntityRepository userEntityRepository;
    @GetMapping("getUserInfo")
    public Result getUserInfo(){
        String id= StpUtil.getLoginIdAsString();
        UsersEntity user = userEntityRepository.getById(id);
        return Result.success(user);
    }
}
